<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>


<html>
    <head>
        <title>薪酬标准管理添加</title>
        <meta http-equiv="content-type" content="text/html;charset=utf-8">
        <link href="../../css/mine.css" type="text/css" rel="stylesheet">
        <script src="/js/jquery.js"></script>
    </head>

    <body>

        <div class="div_head">
            <span>
                <span style="float:left">当前位置是：-》人事管理 -》人事档案管理</span>
                <span style="float:right;margin-right: 8px;font-weight: bold">
                    <a style="text-decoration: none" href="list.jsp">【返回】</a>
                </span>
            </span>
        </div>
        <div></div>

        <div style="font-size: 13px;margin: 10px 5px">
            <form id="form" action="/personnel/add" method="post">
            <table border="1" width="100%" class="table_a">
                <tr>
                    <td width="120px;">档案编码<span style="color:red">*</span>：</td>
                    <td><input readonly type="text" name="danganid" value="******" /></td>
                </tr>

                <tr>
                    <td>所属部门<span style="color:red">*</span>：</td>
                    <td>

                        <select id="dept" name="appartment">
                            <option value="-1">---请选择---</option>
                            <c:forEach items="${deptList}" var="dept">
                                <option value="${dept.id}">${dept.appartmentfullname}</option>
                            </c:forEach>
                        </select>
                    </td>
                </tr>
               
                <tr>
                    <td>档案状态<span style="color:red">*</span>：</td>
                    <td>
						<select name="status">
							<option value="-1">--请选择--</option>
							<option >试用期</option>
                            <option >实习员工</option>
							<option >正式员工</option>
							<option >离职</option>
							<option >已删除</option>

						</select>
					</td>
                </tr>

                <tr>
                    <td>所属职位<span style="color:red">*</span>：</td>
                    <td>

                        <select id="role" name="permname">
                            <option value="-1">---请选择---</option>

                        </select>
                    </td>
                </tr>

                <tr>
                    <td>职称编码<span style="color:red">*</span>：</td>
                    <td>
                        <input type="text" name="permid"  value="BM0011" />
                    </td>
                </tr>


				<tr>
                    <td>姓名<span style="color:red">*</span>：</td>
                    <td>
                        <input type="text" name="username"  value="张华"/>
                    </td>                
                </tr>

				<tr>
                    <td>性别：</td>
                    <td>
                        <input type="radio" name="sex" checked value="男"/>男 <input name="sex" type="radio" value="女"/>女
                    </td>                
                </tr>

				<tr>
                    <td>EMAIL：</td>
                    <td>
                        <input type="text" name="email" value="**@sina.com"/>
                    </td>                
                </tr>

				<tr>
                    <td>联系电话：</td>
                    <td>
                        <input type="text" name="number" value="13988877753" />
                    </td>                
                </tr>

				<tr>
                    <td>住址：</td>
                    <td>
                        <input type="text" name="address" value="北京市朝阳区团结湖101号" />
                    </td>                
                </tr>
				<tr>
                    <td>身份证号：</td>
                    <td>
                        <input type="text" name="idcard" value="4118876546897865689" />
                    </td>                
                </tr>
				<tr>
                    <td>户口所在地：</td>
                    <td>
                        <input type="text" name="localhost" value="北京市" />
                    </td>                
                </tr>
				<tr>
                    <td>政治面貌：</td>
                    <td>
                        <input type="text" name="zhengzhi" value="党员"/>
                    </td>                
                </tr>	

				<tr>
                    <td>毕业院校：</td>
                    <td>
						 <input type="text"  name="school" value="北京航空航天大学" />
                    </td>
                </tr>


				<tr>
                    <td>专业：</td>
                    <td>
                        <input type="text" name="manager" value="计算机应用与科学"/>
                    </td>                
                </tr>
				<tr>
                    <td>学历：</td>
                    <td>
                        <select name="diploma">
							<option>--请选择--</option>
							<option>专科</option>
							<option>本科</option>
							<option >硕士</option>
							<option>博士</option>
						</select>
                    </td>                
                </tr>
				<tr>
                    <td>薪酬标准：</td>
                    <td>
                        <select name="salary">
							<option value="-1">--请选择--</option>
							<option value="1">初级</option>
							<option value="2">中级</option>
							<option value="3">高级</option>
						</select>
                    </td>                
                </tr>
				<tr>
                    <td>开户行：</td>
                    <td>
                        <input type="text" name="accountbank" value="工行北京市团结湖支行"/>
                    </td>                
                </tr>
				<tr>
                    <td>银行卡号：</td>
                    <td>
                        <input type="text" name="bankcardnumber" value="63304578623159"/>
                    </td>                
                </tr>
				<tr>
                    <td>社保卡号：</td>
                    <td>
                        <input type="text" name="socialcardnumber" value="63304578623159"/>
                    </td>                
                </tr>
				<tr>
                    <td>登记人：</td>
                    <td>
                        <input readonly type="text" name="levelperson" value="${sessionScope.user.username}"/>
                    </td>                
                </tr>
				<tr>
                    <td>建档时间：</td>
                    <td>
                        <input type="text" name="creattime" value="2015-11-01"/>
                    </td>                
                </tr>
				<tr>
                    <td>个人履历：</td>
                    <td>
                        <textarea name="info"></textarea>
                    </td>                
                </tr>
				<tr>
                    <td>家庭关系信息：</td>
                    <td>
                        <textarea name="family"></textarea>
                    </td>                
                </tr>
				<tr>
                    <td>备注：</td>
                    <td>
                        <textarea name="des"></textarea>
                    </td>                
                </tr>
				<tr>
                    <td>简历附件：</td>
                    <td>
                        <input type="file"  value=""/>
                    </td>                
                </tr>
				<tr>
                    <td></td>
                    <td>
                        <a href="">张华个人简历.doc</a>  <a href="">删除</a>
                    </td>                
                </tr>
				
                <tr>
                    <td colspan="2" align="center">
                        <input type="submit" value="添加">
						<input type="reset" value="清空">
						<button type="button" value="提交审核" id="checkBtn"/>提交审核
                    </td>
                </tr>
            </table>
            </form>
        </div>

        <script>
            //二级联动
            $("#dept").change(function () {
                //1.获得被选中的value值
                var deptId= $(this).val();
                if(deptId==-1){
                    alert("请选择部门");
                }else{
                    //将deptId的值传给服务器，服务器进行查询
                    $.ajax({
                        url:"/user/getRoles",
                        data:"deptId="+deptId,
                        type:"post",
                        dataType:"json",
                        success:function(rs){//rs用来接受返回的结果
                            $("#role")[0].length=0;//让下拉框的长度为0
                            for(var i=0;i<rs.length;i++){
                                $("#role")[0].add(new Option(rs[i].permname));//Option(显示到标签对中的值,value值)
                            }
                        }
                    })
                }

            });

            // 提交审核:先执行添加，成功后修改状态为审核中
            $("#checkBtn").click(function () {
                console.log("sad")
                //得到表单数据
                var data=$("#form").serialize();
                //发送AJAX请求，提交表单
                $.post(
                    "/personnel/add-checking",
                    data,
                    function (result) {
                        if (result.code==0){
                            //添加档案成功
                            //修改审核状态为审核中
                            alert(result.msg);
                            location.href="/personnel/manage";

                        } else {
                            //添加失败
                            alert(result.msg);
                            location.href="/personnel/add-ui";
                        }
                    },
                    "json"
                );
            });

        </script>
    </body>
</html>